# -*- coding: UTF-8 -*-
import yaml
import os
from common.read_config import Environ0

def get_yaml_filepath(Environ="", filepath=""):
    Environ1 = os.path.abspath(os.path.dirname(os.path.dirname(__file__)) + Environ0) + "/" + Environ  # 拼接定位到data文件夹
    filepath1 = os.path.abspath(os.path.dirname(os.path.dirname(__file__)) + r"/data") + filepath  # 拼接定位到data文件夹
    if Environ:
        with open(Environ1, "r", encoding="utf-8") as f:
            return yaml.load(f, Loader=yaml.FullLoader)
    if filepath:
        with open(filepath1, "r", encoding="utf-8") as f:
            return yaml.load(f, Loader=yaml.FullLoader)


if __name__ == '__main__':
    print("ddd", get_yaml_filepath(Environ=Environ0))
    # print("ggg",get_yaml_filepath(filepath='member_controller\login.yaml'))
